<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles" %>


<div class="panel panel-success">
    <div class="panel-heading">
        <div class="panel-title">Grant Areas</div>
    </div>
    <div class="panel-body">
        <ul class="nav nav-sidebar">
            <c:forEach items="${grantAreasMenu}" var="menuItem">
                <li class=""><a href="<c:url value="/area/${menuItem.link}" />">${menuItem.name}<span
                        class="badge pull-right">${menuItem.grantApplication.size()}</span></a></li>
            </c:forEach>
        </ul>
    </div>
</div>

<c:if test="${not empty sessionUser}">
    <div class="panel panel-info">
        <div class="panel-heading">
            <div class="panel-title">
                Controls
            </div>
        </div>
        <div class="panel-body">
            <ul class="nav nav-sidebar">
                <li><a href="<c:url value="/grant/create" />">New Grant Application</a></li>
                <li><a href="<c:url value="/profile/edit" />">Edit My Profile</a></li>
                <li><a href="<c:url value="/my/feed" />">My feed</a></li>
            </ul>
        </div>
    </div>
    <c:if test="${sessionUser.role.roleName == 'ROLE_ADMIN'}">
        <div class="panel panel-warning">
            <div class="panel-heading">
                <div class="panel-title">Admin features</div>
            </div>
            <div class="panel-body">
                <ul class="nav nav-sidebar">
                    <li><a href="<c:url value="/admin/grants/viewAll" />">New Grant Applications<span
                            class="badge pull-right">${grantApplicationsRequested}</span></a></li>
                    <li><a href="<c:url value="/admin/areas/viewAll" />">Manage areas</a></li>
                    <li><a href="<c:url value="/admin/users/viewAll" />">Manage users</a></li>

                    <li><a href="<c:url value="#" />">Manage money</a></li>
                    <li><a href="<c:url value="/admin/report" />">Reports</a></li>
                </ul>
            </div>
        </div>
    </c:if>

</c:if>